﻿#r @"..\Microsoft.SharePoint.Client (spo)\Microsoft.SharePoint.Client.dll"
#r @"..\Microsoft.SharePoint.Client (spo)\Microsoft.SharePoint.Client.Runtime.dll"
#load "Client.fs"

open Client
open Microsoft.SharePoint.Client
open Microsoft.SharePoint.Client.Application

// =======================================================
// Work with Websites
// =======================================================

let web = Client.Context.Web
Client.Load web

web.Url

// Delete a web
web.DeleteObject()
Client.ExecuteQuery()

// Retrieve active features
let features = web.Features
Client.Load features

// Work with localization
web.Language
web.IsMultilingual <- true
web.AddSupportedUILanguage(1031)
web.Update()
Client.ExecuteQuery()


web.RemoveSupportedUILanguage(1031)
web.Update()
Client.ExecuteQuery()

// Work with web templates
let x : uint32 = uint32 1033
let templates = web.GetAvailableWebTemplates(x, true)
for t in templates do
    Client.Load t
    Client.ExecuteQuery()